<?php
/*! \brief
 * This is WFConfigFactory class
 * This is the Simple Factory Class that create relative Config Class
 * \author William Su
 */
class WFConfigFactory
{
	private static $instance;
	/**
	 * @var WF
	 */
	private $objFramework;
	public function __construct($objFramework){
		$this->objFramework = $objFramework;
	}
    public static function getDirnameFile(){
		if(!isset(self::$instance[__FUNCTION__])){
		    self::$instance[__FUNCTION__] = dirname(__FILE__);
		}
		return self::$instance[__FUNCTION__];
	}
	/**
	 * @return WFConfig
	 */
	public function getConfig(){
		if(!isset(self::$instance[__FUNCTION__])){
			require_once self::getDirnameFile().'/Config.php';
			self::$instance[__FUNCTION__] = new WFConfig($this->objFramework);
		}
		return self::$instance[__FUNCTION__];
	}
	/**
	 * @return WFOpt
	 */
	public function getOpt(){
		if(!isset(self::$instance[__FUNCTION__])){
			require_once self::getDirnameFile().'/Opt.php';
			self::$instance[__FUNCTION__] = new WFOpt($this->objFramework);
		}
		return self::$instance[__FUNCTION__];
	}
/**
	 * @return WFExitCode
	 */
	public function getExitCode(){
		if(!isset(self::$instance[__FUNCTION__])){
			require_once self::getDirnameFile().'/ExitCode.php';
			self::$instance[__FUNCTION__] = new WFExitCode($this->objFramework);
		}
		return self::$instance[__FUNCTION__];
	}
}